<template>
  <section>
    <el-row style="margin:10px 30px;">
      您的孩子整体身体情况属于 <span style="font-size: 48px;font-weight:bold;">{{reportData.data.physicalGrade.name}}</span> 级。
    </el-row>
    <el-row style="margin:10px 30px;">
      <div v-html="reportData.data.physicalGrade.analysis"></div>
    </el-row>
    <el-row>
      <img style="width:840px;" :src="getGradeImage(reportData.data.physicalGrade.name)" />
    </el-row>
    <el-row>
      <img style="width:800px;margin-left:20px;" src="http://img.fsthz.com/uploads/public/dfcc6b3f50c1df5af6fde4e70e565be9.png" />
    </el-row>
  </section>
</template>

<script>
  import Vue from 'vue'
  export default {
    name: "page-tizhi-c",
    props: ['reportData', 'widget', 'showConfDialog'],
    data(){
      return {
        gradeList:[
          {key:'A-',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'A',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'A+',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'B-',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'B',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'B+',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'C-',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'C',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'C+',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'D-',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'D',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          {key:'D+',image:'http://img.fsthz.com/uploads/public/6886620f93086154038626377308dced.png'},
          ]
      }
    },
    created(){
      if(Object.getOwnPropertyNames(this.widget.data).length < 3){
        this.widget.data.physicalGrade = this.reportData.data.physicalGrade
        this.widget.data.gradeImage = this.getGradeImage(this.reportData.data.physicalGrade.name)
        this.widget.data.treeImage = 'http://img.fsthz.com/uploads/public/dfcc6b3f50c1df5af6fde4e70e565be9.png'
        this.$emit('done',this.widget.data)
      }
    },
    methods:{
      getGradeImage(grade){
        let gradeData = this.gradeList.find(res=> res.key === grade)
        if(gradeData) return gradeData.image
        else
          return ''
      }
    }
  }
</script>

<style scoped>

</style>
